<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>平台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" type="text/css" href="/css/plugins/dropzone/basic.css"/>
    <link rel="stylesheet" type="text/css" href="/css/plugins/dropzone/dropzone.css"/>
    <link rel="stylesheet" type="text/css" href="/css/plugins/layui-formSelect/formSelects-v4.css"/>
    <link rel="stylesheet" type="text/css" href="/css/plat-style.css"/>
    <style>
        img{margin-left: 5px}
    </style>
</head>
<body>
<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-tab layui-tab-brief" lay-filter="test">
                <ul class="layui-tab-title">
                    <li class="layui-this" lay-id="1">&nbsp;&nbsp;&nbsp;手机号码充值金额设置&nbsp;&nbsp;&nbsp;</li>
                    <li lay-id="2">&nbsp;&nbsp;&nbsp;加油卡充值金额设置&nbsp;&nbsp;&nbsp;</li>
                    <li lay-id="3">&nbsp;&nbsp;&nbsp;用户当天充值金额限制&nbsp;&nbsp;&nbsp;</li>
                </ul>
                <div class="layui-tab-content">
                    <!-- 手机号码充值金额设置 -->
                    <div class="layui-tab-item layui-show" style="margin-top: 20px">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th width="10%">充值到账金额</th>
                                <th width="10%">用户实际所花金额</th>
                                <th width="10%">状态</th>
                                <th width="10%">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${phoneAmountSet}" var="al">
                                <tr class="text-c">
                                    <td>${al.rechargemoney}</td>
                                    <td>${al.realmoney}</td>
                                    <td>
                                        <c:if test="${al.status == 0}">无效</c:if>
                                        <c:if test="${al.status == 1}"><font color="green">有效</font></c:if>
                                    </td>
                                    <td>
                                        <button data-id="${al.id}" data-type="updatePhoneParam" type="button"
                                                class="layui-btn layui-btn-sm layui-btn-warm updatePhoneParam">编辑
                                        </button>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>

                    <!-- 加油卡充值金额设置 -->
                    <div class="layui-tab-item" style="margin-top: 20px">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th width="10%">充值到账金额</th>
                                <th width="10%">用户实际所花金额</th>
                                <th width="10%">状态</th>
                                <th width="10%">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${oilAmountSet}" var="al">
                                <tr class="text-c">
                                    <td>${al.rechargemoney}</td>
                                    <td>${al.realmoney}</td>
                                    <td>
                                        <c:if test="${al.status == 0}">无效</c:if>
                                        <c:if test="${al.status == 1}"><font color="green">有效</font></c:if>
                                    </td>
                                    <td>
                                        <button data-id="${al.id}" data-type="updateOilParam" type="button"
                                                class="layui-btn layui-btn-sm layui-btn-warm updateOilParam">编辑
                                        </button>
                                    </td>
                                </tr>
                            </c:forEach>
                            </tbody>
                        </table>
                    </div>

                    <!-- 用户当天充值限额 -->
                    <div class="layui-tab-item" style="margin-top: 20px">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th width="10%">当天充值金额上限</th>
                                <th width="10%">状态</th>
                                <th width="10%">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                                <tr class="text-c">
                                    <td>${rechargeAmountLimit.realmoney}</td>
                                    <td>
                                        <c:if test="${rechargeAmountLimit.status == 0}">无效</c:if>
                                        <c:if test="${rechargeAmountLimit.status == 1}"><font color="green">有效</font></c:if>
                                    </td>
                                    <td>
                                        <button data-id="${rechargeAmountLimit.id}" data-type="updateRechargeAmountLimit" type="button"
                                                class="layui-btn layui-btn-sm layui-btn-warm updateRechargeAmountLimit">编辑
                                        </button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="tabIndex" value="${tabIndex}">
<script src="/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript" src="/js/plugins/image/previewImg.js"></script>
<script type="text/javascript" src="/js/plugins/dropzone/dropzone.js"></script>
<script type="text/javascript" src="/js/plugins/layui-formSelect/formSelects-v4.min.js"></script>
<script>
    layui.config({
        //静态资源所在路径
        base: '/layuiadmin/'
    }).extend({
        //主入口模块
        index: 'lib/index'
    }).use(['index', 'form','upload'], function(){
        var $ = layui.$, admin = layui.admin, element = layui.element, layer = layui.layer;
        //tab绑定事件，页面刷新时定位到制定的tab
        //使用的是layui的'lay-id'属性
        var tabIndex = $("#tabIndex").val();
        element.tabChange('test',tabIndex);

        var active = {
            updatePhoneParam: function (id) {
                layer.open({
                    title:'编辑话费充值金额',
                    type: 2,
                    area: ['550px', '520px'],
                    content: '/recharge/amountEdit?id='+id
                });
            },
            updateOilParam: function (id) {
                layer.open({
                    title:'编辑加油卡充值金额',
                    type: 2,
                    area: ['550px', '520px'],
                    content: '/recharge/amountEdit?id='+id
                });
            },
            updateRechargeAmountLimit: function (id) {
                layer.open({
                    title:'编辑用户当天充值上限金额',
                    type: 2,
                    area: ['550px', '520px'],
                    content: '/recharge/amountEdit?id='+id
                });
            }
        };

        var type = 'editThis';
        $('.updatePhoneParam').on('click', function(){
            var id = $(this).data('id');
            var updateType = $(this).data('type');
            active[updateType] && active[updateType].call(this,id);
        });
        $('.updateOilParam').on('click', function(){
            var id = $(this).data('id');
            var deleteType = $(this).data('type');
            active[deleteType] && active[deleteType].call(this,id);
        });
        $('.updateRechargeAmountLimit').on('click', function(){
            var id = $(this).data('id');
            var deleteType = $(this).data('type');
            active[deleteType] && active[deleteType].call(this,id);
        });
    });


</script>
</body>
</html>